package com.sbj.dto.res;

import cn.zhxu.bs.SearchResult;
import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author summer
 * @version 1.0
 * @date 2024/8/12 10:31
 */
@Data
@SearchBean(tables = " member m LEFT JOIN (SELECT count(*) as num, inviter FROM member ) m1 ON m.inviter_code=m1.inviter",autoMapTo = "m",orderBy = "m.createTime DESC")
public class FansRes implements Serializable {

    @DbField("m.id")
    private Integer id;

    @DbField("m.nickName")
    private String nickName;

    @DbField("m.inviter")
    private String inviter;

    @DbField("CASE WHEN m1.num IS NULL THEN 0 ELSE m1.num END ")
    private Integer inviterNum;

    @DbField("m.phone")
    private String phone;

    @DbField("m.avatar_image")
    private String image;

    @DbField("m.createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;

}
